package com.community.controller;

import com.community.base.BaseController;
import com.community.common.Const;
import com.community.common.ServerResponse;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 评论控制层
 */
@RestController
@RequestMapping("/answerCommentController/")
@CrossOrigin(origins = Const.REQUESTURL,maxAge = 3600,allowCredentials = "true")
public class AnswerCommentController extends BaseController {

    /**
     * 查询回答评论
     * @param pageNum
     * @param aid
     * @return
     */
    @GetMapping("selectByAcid.do")
    public ServerResponse<PageInfo> selectByAcid(@RequestParam(value = "pageNum") int pageNum,
                                                 @RequestParam(value = "aid") int aid){
        return iAnswerCommentService.selectByAcid(pageNum,aid);
    }

    /**
     * 新增评论
     * @param paramMap
     * @param request
     * @return
     */
    @PostMapping("add.do")
    public ServerResponse<String> add(@RequestParam Map paramMap, HttpServletRequest request){
        return iAnswerCommentService.add(paramMap,request);
    }

}
